<template>
	<div class="mainWrapper">
		<el-breadcrumb separator="/">
			<el-breadcrumb-item :to="{ path: '/' }">
				<i class="lh lh-diaodu fw_100"></i>
			</el-breadcrumb-item>
			<el-breadcrumb-item>调度中心</el-breadcrumb-item>
			<el-breadcrumb-item>报名查询</el-breadcrumb-item>
		</el-breadcrumb>

		<div class="content_Box box-shadow">
			<div class="py_5 px_10">
				<el-row>
					<el-col :span="24" class="fr">
						<el-form :inline="true" :model="ruleForm" class="form-inline fr" @keyup.enter.native="shearchBtn()">
							<el-form-item>
								<el-input size="mini" class="w_120" v-model="sn" placeholder="订单编号"></el-input>
							</el-form-item>
							<el-form-item class="mt">
								<el-cascader
									v-model="type_arr"
									:options="TypeArr"
									:props="optionProps"
									placeholder="请选择岗位"
									@change="changeBtndialogtype"
									clearable
								>
								</el-cascader>
							</el-form-item>
							<!-- <el-select size="mini" class="w_120" v-model="type_arr" placeholder="岗位" @change="changeBtndialogtype">
								<el-option
									v-for="item in TypeArr"
									:key="item.id"
									:label="item.label_name"
									:value="`${item.id}|${item.label_name}`"
								></el-option>
							</el-select> -->
							<el-form-item>
								<el-autocomplete
									size="mini"
									class="w_150"
									v-model="shop_name"
									:fetch-suggestions="querySearch"
									placeholder="店铺名称"
									:trigger-on-focus="true"
									@select="handleSelect"
								></el-autocomplete>
							</el-form-item>
							<lh-agent-list @sendValue="setValue" :reset="agent_reset"></lh-agent-list>
							<el-form-item>
								<el-select class="w_110" v-model="city_val" placeholder="请选择城市" @change="changeCity">
									<el-option
										v-for="item in cityList"
										:key="item.id"
										:label="item.name"
										:value="`${item.id}|${item.name}|${item.city_sn}`"
									></el-option>
								</el-select>
							</el-form-item>
							<el-form-item>
								<el-select
									v-model="s_time_slot"
									multiple
									collapse-tags
									placeholder="商圈"
									@change="changeBtndialogarea"
								>
									<el-button
										size="mini"
										type="primary"
										class="round-right all-area"
										@click="selectAllArea()"
										native-type="button"
										>{{ areaStatus ? '全选' : '取消全选' }}</el-button
									>
									<el-option
										v-for="item in areaList"
										:key="item.id"
										:label="item.area_name"
										:value="`${item.id}|${item.area_name}`"
									></el-option>
								</el-select>
							</el-form-item>

							<el-form-item prop="datetime1">
								<el-date-picker
									size="mini"
									type="date"
									class="w_120i"
									value-format="yyyy-MM-dd"
									placeholder="用工开始时间"
									v-model="ruleForm.date1"
								></el-date-picker> </el-form-item
							>~
							<el-form-item prop="datetime2">
								<el-date-picker
									size="mini"
									type="date"
									class="w_120i"
									value-format="yyyy-MM-dd"
									placeholder="用工结束时间"
									v-model="ruleForm.date2"
								></el-date-picker>
							</el-form-item>
							<el-form-item>
								<el-select size="mini" class="w_120" v-model="signStatus" placeholder="状态" clearable>
									<el-option label="已报名" value="1"></el-option>
									<el-option label="已录用" value="2"></el-option>
									<el-option label="未录用" value="3"></el-option>
								</el-select>
							</el-form-item>
							<el-form-item>
								<el-input size="mini" class="w_100" v-model="s_yuyue_name" placeholder="报名人"> </el-input
							></el-form-item>
							<el-form-item>
								<el-input size="mini" class="w_110" v-model="s_yuyue_merchant_phone" placeholder="手机号"></el-input>
							</el-form-item>
							<el-form-item prop="datetime1">
								<el-form-item prop="date4">
									<el-date-picker
										class="w_160i"
										v-model="ruleForm.date4"
										type="datetime"
										value-format="yyyy-MM-dd HH:mm:ss"
										format="yyyy-MM-dd HH:mm"
										placeholder="报名开始时间"
									>
									</el-date-picker>
								</el-form-item> </el-form-item
							>~
							<el-form-item prop="datetime2">
								<el-form-item prop="date5">
									<el-date-picker
										class="w_160i"
										v-model="ruleForm.date5"
										type="datetime"
										value-format="yyyy-MM-dd HH:mm:ss"
										format="yyyy-MM-dd HH:mm"
										placeholder="报名结束时间"
									>
									</el-date-picker>
								</el-form-item>
							</el-form-item>
							<el-button size="mini" type="primary" class="round-right" native-type="button" @click="shearchBtn"
								>搜索</el-button
							>
							<el-button size="mini" round @click="resetBtn">重置</el-button>
							<el-button type="default" @click="downloadOrder()" round size="mini">导出</el-button>
						</el-form>
					</el-col>
				</el-row>
			</div>

			<div class="tableMaxBox">
				<template>
					<!-- 表格部分 -->
					<el-table :data="demandList" stripe>
						<el-table-column prop="sn" label="订单编号" width="120">
							<template slot-scope="{ row }">
								<!-- <el-link type="primary" @click="goToMore(row)">{{row.demand_sn}}</el-link> -->
								<el-link :underline="false">{{ row.demand_sn }}</el-link>
							</template>
						</el-table-column>
						<el-table-column prop="shop_name" label="店铺名称" min-width="150">
							<template slot-scope="{ row }">
								<!-- <el-link type="primary" @click="goToMore(row)">{{row.shop_name}}</el-link> -->
								<el-link :underline="false">{{ row.shop_name }}</el-link>
							</template>
						</el-table-column>
						<el-table-column prop="city_name" label="城市" width="80"></el-table-column>
						<el-table-column prop="area_name" label="商圈" width="80"></el-table-column>
						<el-table-column prop="label_name" label="岗位" width="80"></el-table-column>
						<el-table-column prop="demand_date" label="用工开始 ~ 结束时间" width="160px"></el-table-column>
						<el-table-column prop="hours" label="时长" width="80">
							<template slot-scope="{ row }">
								<span>{{ row.hours }}h</span>
							</template>
						</el-table-column>
						<el-table-column prop="status_name" label="状态" width="80"></el-table-column>
						<el-table-column prop="staff_name" label="报名人" width="150px">
							<template slot-scope="{ row }">
								<el-tooltip effect="light" placement="top" :open-delay="500">
									<div class="wrap_show" slot="content">
										<div>
											<img :src="user_history.avatar" alt="头像" />
											<el-rate
												v-model="user_history.level"
												:colors="colors"
												disabled
												style="margin-top: 10px;"
											></el-rate>
										</div>
										<div>
											<div class="show_line">
												<div style="width: 110px; text-align: right;">平台服务经历：</div>
												<div v-if="user_history.service_history.length != 0">
													<div v-for="(item, index) in user_history.service_history" :key="index">
														<span v-if="item.is_this == false" style="display: inline-block; width: 130px;">{{
															item.shop_name
														}}</span>
														<span
															v-if="item.is_this == true"
															style="display: inline-block; width: 130px; color: var(--orange1);"
															>{{ item.shop_name }}</span
														>
														<span v-if="item.is_this == false">{{ item.task_num }}次</span>
														<span v-if="item.is_this == true" style="color: var(--orange1);"
															>{{ item.task_num }}次</span
														>
													</div>
												</div>
												<div v-if="user_history.service_history.length == 0">
													无
												</div>
											</div>
											<div class="show_line">
												<div style="width: 110px; text-align: right;">工作经历：</div>
												<div v-if="user_history.task_history.length != 0">
													<div v-for="(item, index) in user_history.task_history" :key="index">
														<span>{{ item.start_time }}至{{ item.end_time }}</span>
														<span>{{ item.enterprise_name }}</span>
														<span>{{ item.position }}</span>
													</div>
												</div>
												<div v-if="user_history.task_history.length == 0">
													无
												</div>
											</div>
											<div class="show_line">
												<div style="width: 110px; text-align: right;">学历：</div>
												<div v-if="user_history.education != ''">
													<div>
														<span>{{ user_history.education }}</span>
													</div>
												</div>
												<div v-if="user_history.education == ''">
													<div>
														<span>无</span>
													</div>
												</div>
											</div>
											<div class="show_line">
												<div style="width: 110px; text-align: right;">常驻地址：</div>
												<div v-if="user_history.address != ''">
													<div>
														<span>{{ user_history.address }}&nbsp;{{ user_history.detailed_address }}</span>
													</div>
												</div>
												<div v-if="user_history.address == ''">
													<div>
														<span>无</span>
													</div>
												</div>
											</div>
										</div>
									</div>
									<div>
										<span
											class="pointer u text-primary"
											@mouseover="cellMouseEnter(row)"
											@mouseout="cellMouseLeave"
											@click="toPersonnelListHx(row)"
											>{{ row.staff_name }}</span
										>
										<span
											v-if="row.newPeople == 1"
											style="background: #c93a32; color: #fff; padding: 2px 3px; border-radius: 3px;"
											>新</span
										>
									</div>
								</el-tooltip>
							</template>
						</el-table-column>
						<el-table-column prop="staff_mobile" label="手机号" width="150px"></el-table-column>
						<el-table-column prop="level" label="星级" width="50px"></el-table-column>
						<el-table-column prop="job_types" label="岗位设置" min-width="100px"></el-table-column>
						<el-table-column prop="set_type" label="空闲时段类别" width="100px"></el-table-column>
						<el-table-column prop="job_times" label="空闲时段" min-width="100px"></el-table-column>
						<el-table-column prop="add_time" label="报名时间" width="150px"></el-table-column>
					</el-table>
					<!-- 分页组件 -->
					<page :total="total" :pageNums="pageNum" @pagedata="onChildValue"></page>
				</template>
			</div>
		</div>
	</div>
</template>

<script>
var common = require('../../../static/tool.js')
import { mainfun } from '../../../assets/js/main.js'
import { publicData } from '../../../assets/js/data.js'
import { fetchAreaList } from '@/api/shop.js'
import { fetchIndustryJob } from '@/api/label.js'
export default {
	name: 'ShopList',
	data() {
		return {
			id: '',
			dataMes: '',
			ids: '',
			id_id: '',
			ids_name: '',
			agreement: '',
			index: '',
			windowSizeHeight: document.documentElement.clientHeight, //浏览器可视化窗口的大小
			screenHeight: document.documentElement.clientHeight,
			manageInfo: JSON.parse(sessionStorage.getItem('manageInfo')), //登录信息
			url: common.url,
			head_url: common.head_url,
			//搜索对应值
			sn: '', //订单编号
			type_arr: '', //需求信息
			label_id: '', //
			label_name: '',
			area_arr: '', //商圈信息
			area_id: '',
			area_name: '',
			business_id: '', //所属商户ID
			business_name: '', //所属商户name
			shop_id: '', //店铺id
			shop_name: '', //店铺名
			status: '', //账号状态： 1:正常  2:禁用
			s_yuyue_name: '', //报名人
			s_yuyue_merchant_phone: '', //手机号
			ruleForm: {
				date1: '', //开始时间
				date2: '', //结束时间
				date3: '', //报名时间
				date4: '', //报名开始时间
				date5: '' //报名结束时间
			},

			TypeArr: [],
			demandList: [], //店铺列表
			BusinessUserList: [], //销售列表
			diaTitle: '', //弹框title
			PersonnelAudit: false, //审核状态弹框
			PersonnelXieYi: false, //协议弹框
			//向分页组件传值
			total: 0,
			pageNum: '',
			pageSizeNow: '',
			// 审核状态
			text: '',
			merchantsList: [], //商户列表
			areaList: [], //区域列表
			shopList: [], //店铺列表
			user_history: {
				avatar: '',
				education: '无',
				level: 0,
				service_history: [],
				task_history: [],
				address: '',
				detailed_address: ''
			}, //请求人员资料信息
			// 颜色设定
			colors: ['#cf2e22', '#cf2e22', '#cf2e22'],
			agent_reset: 0,
			city_val: '',
			cityList: [], // 城市列表
			city_id: '',
			area_id: '', //商圈ID
			area_name: '', //商圈name
			s_time_slot: '',
			areaStatus: true, //商圈全选
			optionProps: {
				value: 'id',
				label: 'label_name'
			},
			signStatus: ''
		}
	},
	watch: {
		//商圈改变
		areaList(newValue, oldValue) {
			this.listShop()
		}
	},
	created() {
		if (this.$route.query.id) {
			this.id = this.$route.query.id //接收传参
			this.business_id = this.id
		}
		if (!sessionStorage.getItem('manageInfo')) {
			// 判断是否登录
			window.location = 'login.html'
			return
		}

		//时间的默认选中
		var d = this.date(0)
		this.ruleForm.date4 = d + ' 00:00:00'
		var e = this.date(0)
		this.ruleForm.date5 = e + ' 23:59:59'
	},
	mounted() {
		this.getBusinessUser()
		this.getMerchants() //商户列表
		this.listUser() //店铺列表
		this.alljob_type()
		//this.listArea() //区域列表
	},
	methods: {
		date(e) {
			return this.$moment().add('days', e).format('YYYY-MM-DD')
		},
		//获取商户列表
		getMerchants() {
			let fn = new FormData()
			this.$http.post(this.url + '/business/list', fn).then(
				res => {
					// console.log(res.data.data);
					if (res.data.msg == '查询成功!' || res.data.code == '200') {
						if (res.data.data.list != null) {
							res.data.data.list.forEach(item => {
								item.value = item.name
							})
							this.merchantsList = res.data.data.list
						} else {
							this.merchantsList = []
						}
					} else if (res.data.code == '8886') {
						//code   8886  登录过期
						sessionStorage.clear()
						this.$alert('登录已过期，请重新登录 !', '提示', {
							confirmButtonText: '确定',
							callback: action => {
								window.location = 'login.html'
							}
						})
						return
					} else {
						this.$message.error(res.data.msg)
						return
					}
				},
				res => {
					this.$message.error('网络错误！')
					return
				}
			)
		},
		listUser() {
			//获取商铺列表
			let fn = new FormData()
			fn.append('sign_status', 30) //已合作的店铺
			fn.append('status', 1) //启用的店铺
			// fn.append("search_list", 1); //不进行分页
			this.$http.post(this.url + '/shop/getListForSearch', fn).then(
				res => {
					// console.log(res.data.data);
					if (res.data.msg == '查询成功' || res.data.code == '200') {
						if (res.data.data != null) {
							res.data.data.list.forEach(item => {
								item.value = item.name
							})
							this.shopList = res.data.data.list
						} else {
							this.shopList = []
						}
					} else if (res.data.code == '8886') {
						//code   8886  登录过期
						sessionStorage.clear()
						this.$alert('登录已过期，请重新登录 !', '提示', {
							confirmButtonText: '确定',
							callback: action => {
								window.location = 'login.html'
							}
						})
						return
					} else {
						this.$message.error(res.data.msg)
						return
					}
				},
				res => {
					this.$message.error('网络错误！')
					return
				}
			)
		},
		listShop() {
			//获取订单列表
			let fn = new FormData()
			fn.append('pageSize', this.pageSizeNow) //每页多少条
			fn.append('page', this.pageNum) //页数
			fn.append('demand_sn', this.sn)
			if (this.shop_name == '') {
				this.shop_id = ''
			}
			fn.append('shop_sn', this.shop_id)
			fn.append('label_id', this.label_id)
			fn.append('agent_id', this.agent_id)
			fn.append('city_id', this.city_id)
			var s_departmentIds_Arr = []
			this.s_time_slot.forEach(element => {
				let [id, name] = element.split('|')
				s_departmentIds_Arr.push(id.toString())
			})
			fn.append('area_id', s_departmentIds_Arr.toString())
			fn.append('start_date', this.ruleForm.date1)
			if (this.ruleForm.date2 == null) {
				this.ruleForm.date2 = ''
			}
			fn.append('end_date', this.ruleForm.date2)
			if (this.ruleForm.date3 == null) {
				this.ruleForm.date3 = ''
			}
			fn.append('appointment_date', this.ruleForm.date3)
			fn.append('staff_name', this.s_yuyue_name)
			fn.append('mobile', this.s_yuyue_merchant_phone)
			if (this.ruleForm.date4 == null) {
				this.ruleForm.date4 = ''
			}
			fn.append('start_time', this.ruleForm.date4)
			if (this.ruleForm.date5 == null) {
				this.ruleForm.date5 = ''
			}
			fn.append('end_time', this.ruleForm.date5)
			fn.append('status', this.signStatus)

			this.$http.post(this.url + '/appointment/appointmentList', fn).then(
				res => {
					if (res.data.msg == '查询成功！' || res.data.code == '200') {
						if (res.data.data != null) {
							var job_times_arr = res.data.data.list
							job_times_arr.forEach(element => {
								if (element.job_times != '') {
									element.job_times_arr = element.job_times.split(',')
								} else {
									element.job_times_arr = []
								}
							})
							this.demandList = job_times_arr
							// this.demandList = res.data.data.list;
							this.total = res.data.data.count
						} else {
							this.demandList = []
							this.total = 0
						}
					} else if (res.data.code == '8886') {
						//code   8886  登录过期
						sessionStorage.clear()
						this.$alert('登录已过期，请重新登录 !', '提示', {
							confirmButtonText: '确定',
							callback: action => {
								window.location = 'login.html'
							}
						})
						return
					} else {
						this.$message.error(res.data.msg)
						return
					}
				},
				res => {
					this.$message.error('网络错误！')
					return
				}
			)
		},
		//导出
		// 订单编号，店铺编号，店铺名称，城市，商圈，岗位，用工开始/结束时间，时长，人数，人才编号，报名人，手机号，星级，岗位设置，空闲时段类别，空闲时段，报名时间
		downloadOrder() {
			if (this.shop_name == '') {
				this.shop_id = ''
			}
			if (this.ruleForm.date2 == null) {
				this.ruleForm.date2 = ''
			}
			if (this.ruleForm.date1 == null) {
				this.ruleForm.date1 = ''
			}
			if (this.ruleForm.date4 == null) {
				this.ruleForm.date4 = ''
			}
			if (this.ruleForm.date5 == null) {
				this.ruleForm.date5 = ''
			}
			let s_departmentIds_Arr = []
			this.s_time_slot.forEach(element => {
				let [id, name] = element.split('|')
				s_departmentIds_Arr.push(id.toString())
			})
			let obj = {
				operation: 'export',
				token: JSON.parse(sessionStorage.getItem('manageInfo')).token,
				demand_sn: this.sn,
				label_id: this.label_id,
				shop_sn: this.shop_id,
				agent_id: this.agent_id,
				city_id: this.city_id,
				area_id: s_departmentIds_Arr.toString(),
				end_date: this.ruleForm.date2,
				start_date: this.ruleForm.date1,
				staff_name: this.s_yuyue_name,
				mobile: this.s_yuyue_merchant_phone,
				start_time: this.ruleForm.date4,
				end_time: this.ruleForm.date5,
				status: this.signStatus
			}
			let param = $.param(obj)
			window.location.href = this.url + '/appointment/appointmentList?' + param
		},
		//获取销售列表
		getBusinessUser() {
			let fn = new FormData()
			this.$http.post(this.url + '/manageUser/getBusinessUser', fn).then(
				res => {
					// console.log(res.data.data);
					if (res.data.msg == '查询成功!' || res.data.code == '200') {
						if (res.data.data != null) {
							res.data.data.forEach(item => {
								item.value = item.nickname
							})
							this.BusinessUserList = res.data.data
						} else {
							this.BusinessUserList = []
						}
					} else if (res.data.code == '8886') {
						//code   8886  登录过期
						sessionStorage.clear()
						this.$alert('登录已过期，请重新登录 !', '提示', {
							confirmButtonText: '确定',
							callback: action => {
								window.location = 'login.html'
							}
						})
						return
					} else {
						this.$message.error(res.data.msg)
						return
					}
				},
				res => {
					this.$message.error('网络错误！')
					return
				}
			)
		},

		shearchBtn() {
			//判断时间框是否存在值
			if (this.ruleForm.date4 == null || this.ruleForm.date4 == '') {
				this.$message.error('请选择报名开始时间！')
				return
			}
			if (this.ruleForm.date5 == null || this.ruleForm.date5 == '') {
				this.$message.error('请选择报名结束时间！')
				return
			}
			// 搜索
			this.pageNum = 1
			this.listShop()
		},

		resetBtn() {
			console.log('1234')
			//重置
			this.resetData() //重置请求数据
			this.pageNum = 1
			this.listShop()
		},

		resetData() {
			//重置请求数据
			this.pageNum = 1
			this.sn = ''
			this.type_arr = '' //需求信息
			this.label_id = '' //
			this.label_name = ''
			this.area_arr = '' //商圈信息
			this.area_id = ''
			this.area_name = ''
			this.business_id = '' //所属商户ID
			this.business_name = '' //所属商户name
			this.shop_id = '' //店铺id
			this.shop_name = '' //店铺名
			this.status = '' //账号状态： 1:正常  2:禁用
			this.s_yuyue_name = ''
			this.s_yuyue_merchant_phone = ''
			this.ruleForm.date1 = ''
			this.ruleForm.date2 = ''
			this.ruleForm.date3 = ''
			this.ruleForm.date4 = ''
			this.ruleForm.date5 = ''
			this.agent_id = ''
			this.city_id = ''
			this.area_id = ''
		},

		goToEdit(row) {
			//编辑页面
			this.$router.push({
				path: '/merchantsEdit',
				query: {
					id: row.id
				}
			})
		},
		goToMore(row) {
			console.log(row)
			// return;
			this.$router.push({
				path: '/roleMainXq',
				query: {
					rl_id: row.id,
					rl_sn: row.demand_sn,
					start_date: row.start_date.substr(5, 5).trim()
				}
			})
		},
		//店铺的自动完成
		querySearch(queryString, cb) {
			var restaurants = this.shopList
			var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants
			// 调用 callback 返回建议列表的数据
			cb(results)
		},
		createFilter(queryString) {
			return restaurant => {
				return restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
			}
		},
		handleSelect(item) {
			console.log(item)
			this.shop_id = item.shop_sn
		},
		//商户的自动完成
		querySearch3(queryString, cb) {
			var restaurants = this.merchantsList
			var results = queryString ? restaurants.filter(this.createFilter3(queryString)) : restaurants
			// 调用 callback 返回建议列表的数据
			cb(results)
		},
		createFilter3(queryString) {
			return restaurant => {
				return restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
			}
		},
		handleSelect3(item) {
			this.business_name = item.name
			this.business_id = item.id
		},

		//分页组件->子组件传值
		onChildValue(item) {
			console.log('12345')
			this.pageNum = item[0]
			this.pageSizeNow = item[1]
			this.listShop()
		},
		changeBtndialogtype() {
			console.log(this.type_arr)
			this.label_id = this.type_arr[1]
		},
		//标签接口
		// alljob_type() {
		// 	let fn = new FormData()
		// 	fn.append('label_type', 'job_type')
		// 	this.$http.post(this.url + '/label/list', fn).then(
		// 		res => {
		// 			if (res.data.msg == '查询成功' || res.data.code == '200') {
		// 				this.TypeArr = res.data.data
		// 			} else if (res.data.code == '8886') {
		// 				//code   8886  登录过期
		// 				sessionStorage.clear()
		// 				this.$alert('登录已过期，请重新登录 !', '提示', {
		// 					confirmButtonText: '确定',
		// 					callback: action => {
		// 						window.location = 'login.html'
		// 					}
		// 				})
		// 				return
		// 			} else {
		// 				this.$message.error(res.data.msg)
		// 				return
		// 			}
		// 		},
		// 		res => {
		// 			this.$message.error('网络错误！')
		// 			return
		// 		}
		// 	)
		// },
		//标签接口 搜索获取
		async alljob_type() {
			this.type_arr = ''
			try {
				let ret = await fetchIndustryJob({
					city_id: this.city_id
				})
				if (ret.length > 0) {
					this.TypeArr = ret
				} else {
					this.TypeArr = []
				}
			} catch (err) {
				console.log(err)
			}
		},
		changeBtndialogarea() {
			let [id, name] = this.area_arr.split('|') // es6 数组解构赋值
			this.area_id = id.toString()
			this.area_name = name.toString()
		},
		//进入单元行
		cellMouseEnter(row, column, cell, event) {
			publicData.isShowLoading = false
			console.log(row)
			// 请求人员资料信息
			let fn = new FormData()
			fn.append('staff_id', row.staff_id)
			fn.append('shop_sn', row.shop_sn)
			setTimeout(() => {
				this.$http.post(this.url + '/user/history', fn).then(
					res => {
						if (res.data.msg == '操作成功！' || res.data.code == '200') {
							var user_history = res.data.data
							if (user_history.avatar != undefined) {
								// 头像判断
								if (user_history.avatar == '') {
									user_history.avatar = this.head_url + 'images/160102759620181.png'
								} else {
									if (user_history.avatar.indexOf('https') == -1) {
										// 自己传的头像
										user_history.avatar = this.head_url + user_history.avatar
									} else {
										// 微信头像
										user_history.avatar = user_history.avatar
									}
								}
								this.user_history = user_history
							} else {
								this.user_history = {
									avatar: this.head_url + 'images/160102759620181.png',
									education: '无',
									level: 0,
									service_history: [],
									task_history: [],
									address: '',
									detailed_address: ''
								}
							}
						}
					},
					res => {}
				)
			}, 300)
		},
		// 离开单元行
		cellMouseLeave() {
			setTimeout(() => {
				publicData.isShowLoading = true
			}, 1000)
		},
		//跳转人才画像
		toPersonnelListHx(row) {
			const { href } = this.$router.resolve({ path: '/personnelListHx', query: { id: row.staff_id } })
			window.open(href, '_blank')
		},
		//代理商
		async setValue(arrVal) {
			this.agent_id = arrVal.agent_id
			this.cityList = arrVal.city_list
			this.city_val = this.cityList[0].name
			this.city_id = this.cityList[0].id
			await this.listArea(this.city_id) //商圈列表
			this.alljob_type()
		},
		// 监听城市val变化
		async changeCity() {
			let [id, name, city_sn] = this.city_val.split('|') // es6 数组解构赋值
			this.city_id = id
			this.city_name = name
			this.city_sn = city_sn
			await this.listArea(this.city_id) //商圈列表
			this.alljob_type()
		},
		//获取商圈列表
		async listArea(city_id) {
			try {
				this.s_time_slot = []
				let ret = await fetchAreaList({
					city_id: city_id,
					agent_id: this.agent_id
				})
				if (ret.list.length) {
					ret.list.forEach(item => {
						item.value = item.area_name
					})
					this.areaList = ret.list
					// 如果本地this.area_arr。存在值，那么不再赋予，如果不存在。赋予相关值
					// if (this.s_time_slot == '' || this.s_time_slot == null) {
					// 	// 默认选中非254-平谷的
					// 	this.areaList.forEach(element => {
					// 		// 平谷
					// 		if (element.area_name != '平谷') {
					// 			var pusharr = element.id + '|' + element.area_name
					// 			this.s_time_slot.push(pusharr)
					// 		}
					// 	})
					// }
				} else {
					this.areaList = []
				}
			} catch (err) {
				console.log('获取商圈' + err)
			}
		},
		//全选-取消全选商圈
		selectAllArea() {
			let arr = []
			this.areaList.forEach(item => {
				arr.push(`${item.id}|${item.area_name}`)
			})
			if (this.areaStatus == true) {
				this.s_time_slot = arr
			} else {
				this.s_time_slot = []
			}
			this.areaStatus = !this.areaStatus
		}
	},
	filters: {
		ReversalTime: function (value) {
			value = value % 24
			return common.getReversalTime(value)
		},
		dateshear: function (value) {
			value = value.substr(5, 5).trim()
			return value
		}
	}
}
</script>

<style scoped>
.auditCentent .labels {
	min-height: 100px;
}
.auditCentent .labels .labels_label {
	float: left;
	cursor: pointer;
}
.check_label {
	background: var(--purple4);
	color: #fff;
	border: none;
}
.pdf {
	width: 860px;
	height: 600px;
}
.main_user {
	background: var(--zfy-red);
	color: #fff;
	text-decoration: none;
	padding: 2px 4px;
	border-radius: 4px;
}
.wrap_show {
	display: flex;
}

.wrap_show img {
	width: 70px;
	height: 70px;
	margin-left: 10px;
	border-radius: 100%;
}

.wrap_show p {
	text-align: center;
}

.show_line {
	display: flex;
	margin-bottom: 10px;
}
.mt {
	margin-top: -4px;
}
</style>



// WEBPACK FOOTER //
// src/components/roledemand/AppointmentList.vue